home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Online / smbfs / source / include / smb / smb.h < prev    next >
C/C++ Source or Header  |  2000-12-11  |  2KB  |  83 lines

  1. /*
  2.  * $Id: smb.h,v 1.10 2000/12/11 17:48:17 olsen Exp $
  3.  *
  4.  * :ts=8
  5.  *
  6.  * smb.h
  7.  *
  8.  * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke
  9.  * Modified for use with AmigaOS by Olaf Barthel <olsen@sourcery.han.de>
  10.  */
  11.  
  12. #ifndef _LINUX_SMB_H
  13. #define _LINUX_SMB_H
  14.  
  15. #define SMB_PORT 139
  16. #define SMB_MAXNAMELEN 255
  17.  
  18. typedef unsigned char byte;
  19. typedef unsigned short word;
  20. typedef unsigned long dword;
  21.  
  22. /*
  23.  * Set/Get values in SMB-byte order
  24.  */
  25.  
  26. #define PVAL(buf,pos)   ((unsigned)BVAL(buf,pos))
  27.  
  28. #define BVAL(buf,pos)   (((unsigned char *)(buf))[pos])
  29. #define WVAL(buf,pos)   (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8)
  30. #define DVAL(buf,pos)   (WVAL(buf,pos)|WVAL(buf,(pos)+2)<<16)
  31.  
  32. #define BSET(buf,pos,val)     (BVAL(buf,pos)=((val) & 0xFF))
  33. #define WSET(buf,pos,val) do { BVAL(buf,pos)=((val) & 0xFF); BVAL(buf,(pos)+1)=(unsigned)(val)>>8; } while (0)
  34. #define DSET(buf,pos,val) do { WSET(buf,pos,val); WSET(buf,(pos)+2,(unsigned)(val)>>16); } while (0)
  35.  
  36. #define smb_base(buf) ((byte *)(((byte *)(buf))+4))
  37.  
  38. enum smb_protocol
  39. {
  40.   PROTOCOL_NONE,
  41.   PROTOCOL_CORE,
  42.   PROTOCOL_COREPLUS,
  43.   PROTOCOL_LANMAN1,
  44.   PROTOCOL_LANMAN2,
  45.   PROTOCOL_NT1
  46. };
  47.  
  48. enum smb_conn_state
  49. {
  50.   CONN_VALID,                   /* everything's fine */
  51.   CONN_INVALID,                 /* Something went wrong, but did not
  52.                                    try to reconnect yet. */
  53.   CONN_RETRIED                  /* Tried a reconnection, but was refused */
  54. };
  55.  
  56. struct smb_dskattr
  57. {
  58.   word total;
  59.   word allocblocks;
  60.   word blocksize;
  61.   word free;
  62. };
  63.  
  64. /*
  65.  * Contains all relevant data on a SMB networked file.
  66.  */
  67. struct smb_dirent
  68. {
  69.   int opened;                   /* is it open on the fileserver? */
  70.   word fileid;                  /* What id to handle a file with? */
  71.   word attr;                    /* Attribute fields, DOS value */
  72.  
  73.   time_t atime, mtime, ctime;   /* Times, as seen by the server, normalized */
  74.                                 /* to UTC. The ugly conversion happens in */
  75.                                 /* proc.c */
  76.  
  77.   unsigned long size;           /* File size. */
  78.   char *complete_path;          /* Complete path, MS-DOS notation, with '\' */
  79.   int len;                      /* Namelength. */
  80. };
  81.  
  82. #endif /* _LINUX_SMB_H */
  83.